package controller.persiapan;

import helper.SearchEngine;
import java.awt.event.*;
import java.util.ArrayList;
import model.Game;
import model.players.*;

public class CreatePlayer extends javax.swing.JFrame {
    Game G;
    public static int banyak_pemain;
    public static int max_pemain = 4;
    public static int counter;
    public static String icon_name;
    private boolean boleh_klik = false;
    private boolean show_button = false;
    private boolean[] player_added ;
    
    ArrayList <javax.swing.JPanel> arrayPanel = new ArrayList <javax.swing.JPanel>();
    ArrayList <javax.swing.JLabel> arrayLabel = new ArrayList <javax.swing.JLabel>();
    ArrayList <javax.swing.JTextField> arrayTextField = new ArrayList <javax.swing.JTextField>();
    ArrayList <javax.swing.JButton> arrayButton = new ArrayList <javax.swing.JButton>();
    ArrayList <javax.swing.JButton> arrayButtonH = new ArrayList <javax.swing.JButton>();
    ArrayList <String> arrayIcon = new ArrayList <String>();

    public static Player p1;
    public static Player p2;
    public static Player p3;
    public static Player p4;

    private static boolean human1 = true;
    private static boolean human2 = true;
    private static boolean human3 = true;
    private static boolean human4 = true;

    public Persiapan parent;
    

    public CreatePlayer(Persiapan parent) {
        this.parent = parent;
        initComponents();
        this.setLocationRelativeTo(null);
        this.initialize();
     }

    public void initialize()
    {
        arrayPanel.add(0, null);
        arrayPanel.add(1, jPanel6);
        arrayPanel.add(2, jPanel5);
        arrayPanel.add(3, jPanel3);
        arrayPanel.add(4, jPanel4);

        arrayLabel.add(0, null);
        arrayLabel.add(1, iconP1_label);
        arrayLabel.add(2, IconP2_label);
        arrayLabel.add(3, iconP3_label);
        arrayLabel.add(4, iconP4_label);

        arrayTextField.add(0, player1name_textfield);
        arrayTextField.add(1, player1name_textfield);
        arrayTextField.add(2, player2name_textfield);
        arrayTextField.add(3, player3name_textfield);
        arrayTextField.add(4, player4name_textfield);

        arrayButton.add(0, null);
        arrayButton.add(1, icon_button1);
        arrayButton.add(2,icon_button2);
        arrayButton.add(3,icon_button3);
        arrayButton.add(4,icon_button4);

        arrayButtonH.add(0,null);
        arrayButtonH.add(1,human_button1);
        arrayButtonH.add(2,human_button2);
        arrayButtonH.add(3,human_button3);
        arrayButtonH.add(4,human_button4);

        arrayIcon.add(0, null);
        arrayIcon.add(1, "images0.gif");
        arrayIcon.add(2, "images1.gif");
        arrayIcon.add(3, "images2.gif");
        arrayIcon.add(4, "images3.gif");

        player_added = new boolean[max_pemain+1];
        
        for (int i = 1; i<arrayPanel.size();i++)
        {
            arrayPanel.get(i).setVisible(false);
            arrayButton.get(i).setVisible(false);
            arrayButtonH.get(i).setVisible(false);
        }
        
        boleh_klik = true;
   }

        private void set_computer_name(int index)
    {
            if(arrayIcon.get(counter).equals("images0.gif"))
                arrayTextField.get(index).setText("Blassem");
            else if(arrayIcon.get(counter).equals("images1.gif"))
                arrayTextField.get(index).setText("BaterKap");
            else if(arrayIcon.get(counter).equals("images2.gif"))
                arrayTextField.get(index).setText("Babel");
            else if(arrayIcon.get(counter).equals("images3.gif"))
                arrayTextField.get(index).setText("Vania");
    }

        private void next_counter()
        {
            if (counter >= (arrayIcon.size() - 1) )
            {
                counter = 1;
            }
            else
            {
                counter++;
            }
            System.out.println("ctr = " + counter);
        }


   private void get_currentIcon(int indeks)
   {
        for(int i=1;i<arrayIcon.size();i++)
        {//System.out.println("minta ikon");
            if((counter == i)) 
            {
                arrayLabel.get(indeks).setIcon(SearchEngine.createImageIcon(arrayIcon.get(i).toString()));
                this.icon_name = arrayIcon.get(i).toString();
                System.out.println(icon_name);
            }
        }

   }

   private void chooseIcon(int pemain)
   {
        arrayButton.get(pemain).setVisible(false);
        arrayButtonH.get(pemain).setVisible(false);
        arrayTextField.get(pemain).setEnabled(false);
        this.show_button = true;
        arrayIcon.remove(counter);
        boleh_klik = true;
   }

   @SuppressWarnings("static-access")
    public Player getPlayer (int urutan)
    {
        Player P = null;
        switch (urutan)
        {
            case 1 : P = p1; break;
            case 2 : P = p2; break;
            case 3 : P = p3; break;
            case 4 : P = p4; break;
        }
        return P;
    }
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        player1_panel = new javax.swing.JPanel();
        jPanel1 = new javax.swing.JPanel();
        icon_button1 = new javax.swing.JButton();
        jPanel6 = new javax.swing.JPanel();
        player1name_textfield = new javax.swing.JTextField();
        iconP1_label = new javax.swing.JLabel();
        human_button1 = new javax.swing.JButton();
        player2_panel = new javax.swing.JPanel();
        iconP1_label1 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jPanel5 = new javax.swing.JPanel();
        player2name_textfield = new javax.swing.JTextField();
        IconP2_label = new javax.swing.JLabel();
        icon_button2 = new javax.swing.JButton();
        human_button2 = new javax.swing.JButton();
        player3_panel = new javax.swing.JPanel();
        iconP3_label = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        player3name_textfield = new javax.swing.JTextField();
        icon_button3 = new javax.swing.JButton();
        human_button3 = new javax.swing.JButton();
        player4_panel = new javax.swing.JPanel();
        iconP4_label = new javax.swing.JLabel();
        jPanel4 = new javax.swing.JPanel();
        player4name_textfield = new javax.swing.JTextField();
        icon_button4 = new javax.swing.JButton();
        iconP4_label1 = new javax.swing.JLabel();
        human_button4 = new javax.swing.JButton();
        addplayer_label = new javax.swing.JLabel();
        startgame_label = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setUndecorated(true);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formOpened(evt);
            }
        });

        player1_panel.setBackground(new java.awt.Color(204, 255, 153));
        player1_panel.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        player1_panel.setComponentPopupMenu(iconP1_label.getComponentPopupMenu());
        player1_panel.setName("player1_panel"); // NOI18N
        player1_panel.setPreferredSize(new java.awt.Dimension(143, 404));

        jPanel1.setBackground(new java.awt.Color(204, 255, 153));

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 1, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 31, Short.MAX_VALUE)
        );

        icon_button1.setText("Next Icon");
        icon_button1.setPreferredSize(player1name_textfield.getPreferredSize());
        icon_button1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                icon_button1MouseClicked(evt);
            }
        });

        jPanel6.setBackground(new java.awt.Color(153, 255, 102));
        jPanel6.setPreferredSize(new java.awt.Dimension(122, 39));

        player1name_textfield.setBackground(new java.awt.Color(204, 255, 153));
        player1name_textfield.setFont(new java.awt.Font("Century", 1, 14));
        player1name_textfield.setText("<enter name>");
        player1name_textfield.setBorder(null);
        player1name_textfield.setMargin(jPanel6.getInsets());
        player1name_textfield.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                player1name_textfieldMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(player1name_textfield, javax.swing.GroupLayout.DEFAULT_SIZE, 98, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(player1name_textfield)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        iconP1_label.setName("test"); // NOI18N
        iconP1_label.setPreferredSize(player1name_textfield.getPreferredSize());
        iconP1_label.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                iconP1_labelMouseClicked(evt);
            }
        });

        human_button1.setText("Human");
        human_button1.setPreferredSize(player1name_textfield.getPreferredSize());
        human_button1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                human_button1MouseClicked(evt);
            }
        });

        javax.swing.GroupLayout player1_panelLayout = new javax.swing.GroupLayout(player1_panel);
        player1_panel.setLayout(player1_panelLayout);
        player1_panelLayout.setHorizontalGroup(
            player1_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(player1_panelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(player1_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(player1_panelLayout.createSequentialGroup()
                        .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(player1_panelLayout.createSequentialGroup()
                        .addGroup(player1_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(icon_button1, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(iconP1_label, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 21, Short.MAX_VALUE))
                    .addComponent(human_button1, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        player1_panelLayout.setVerticalGroup(
            player1_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(player1_panelLayout.createSequentialGroup()
                .addGap(22, 22, 22)
                .addGroup(player1_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(30, 30, 30)
                .addComponent(iconP1_label, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(38, 38, 38)
                .addComponent(icon_button1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(human_button1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(17, Short.MAX_VALUE))
        );

        player2_panel.setBackground(new java.awt.Color(204, 255, 255));
        player2_panel.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        player2_panel.setEnabled(false);

        iconP1_label1.setText("Icon2");

        jPanel2.setBackground(new java.awt.Color(204, 255, 255));

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 85, Short.MAX_VALUE)
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 31, Short.MAX_VALUE)
        );

        jPanel5.setBackground(new java.awt.Color(102, 204, 255));

        player2name_textfield.setBackground(new java.awt.Color(204, 255, 255));
        player2name_textfield.setFont(new java.awt.Font("Century", 1, 14));
        player2name_textfield.setText("<enter name>");
        player2name_textfield.setBorder(null);
        player2name_textfield.setPreferredSize(jPanel5.getPreferredSize());
        player2name_textfield.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                player2name_textfieldMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(player2name_textfield, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(player2name_textfield, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        IconP2_label.setPreferredSize(player2name_textfield.getPreferredSize());
        IconP2_label.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                IconP2_labelMouseClicked(evt);
            }
        });

        icon_button2.setText("Next Icon");
        icon_button2.setPreferredSize(player1name_textfield.getPreferredSize());
        icon_button2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                icon_button2MouseClicked(evt);
            }
        });

        human_button2.setText("Human");
        human_button2.setPreferredSize(player1name_textfield.getPreferredSize());
        human_button2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                human_button2MouseClicked(evt);
            }
        });

        javax.swing.GroupLayout player2_panelLayout = new javax.swing.GroupLayout(player2_panel);
        player2_panel.setLayout(player2_panelLayout);
        player2_panelLayout.setHorizontalGroup(
            player2_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(player2_panelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(player2_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(player2_panelLayout.createSequentialGroup()
                        .addGroup(player2_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(IconP2_label, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(110, 110, 110)
                        .addGroup(player2_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(player2_panelLayout.createSequentialGroup()
                                .addGap(58, 58, 58)
                                .addComponent(iconP1_label1))
                            .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                    .addComponent(icon_button2, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(human_button2, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        player2_panelLayout.setVerticalGroup(
            player2_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(player2_panelLayout.createSequentialGroup()
                .addGap(22, 22, 22)
                .addGroup(player2_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(player2_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(player2_panelLayout.createSequentialGroup()
                        .addGap(127, 127, 127)
                        .addComponent(iconP1_label1)
                        .addGap(37, 37, 37))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, player2_panelLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 43, Short.MAX_VALUE)
                        .addComponent(IconP2_label, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(31, 31, 31)))
                .addComponent(icon_button2, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(human_button2, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        player3_panel.setBackground(new java.awt.Color(255, 153, 153));
        player3_panel.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        player3_panel.setEnabled(false);

        iconP3_label.setPreferredSize(player3name_textfield.getPreferredSize());
        iconP3_label.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                iconP3_labelMouseClicked(evt);
            }
        });

        jPanel3.setBackground(new java.awt.Color(255, 102, 102));

        player3name_textfield.setBackground(new java.awt.Color(255, 153, 153));
        player3name_textfield.setFont(new java.awt.Font("Century", 1, 14));
        player3name_textfield.setText("<enter name>");
        player3name_textfield.setBorder(null);
        player3name_textfield.setPreferredSize(jPanel3.getPreferredSize());
        player3name_textfield.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                player3name_textfieldMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(player3name_textfield, javax.swing.GroupLayout.DEFAULT_SIZE, 98, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(player3name_textfield, javax.swing.GroupLayout.DEFAULT_SIZE, 17, Short.MAX_VALUE)
                .addContainerGap())
        );

        icon_button3.setText("Next Icon");
        icon_button3.setPreferredSize(player1name_textfield.getPreferredSize());
        icon_button3.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                icon_button3MouseClicked(evt);
            }
        });

        human_button3.setText("Human");
        human_button3.setPreferredSize(player1name_textfield.getPreferredSize());
        human_button3.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                human_button3MouseClicked(evt);
            }
        });

        javax.swing.GroupLayout player3_panelLayout = new javax.swing.GroupLayout(player3_panel);
        player3_panel.setLayout(player3_panelLayout);
        player3_panelLayout.setHorizontalGroup(
            player3_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(player3_panelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(player3_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(player3_panelLayout.createSequentialGroup()
                        .addGroup(player3_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(icon_button3, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap())
                    .addGroup(player3_panelLayout.createSequentialGroup()
                        .addComponent(iconP3_label, javax.swing.GroupLayout.DEFAULT_SIZE, 108, Short.MAX_VALUE)
                        .addGap(21, 21, 21))
                    .addGroup(player3_panelLayout.createSequentialGroup()
                        .addComponent(human_button3, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap(21, Short.MAX_VALUE))))
        );
        player3_panelLayout.setVerticalGroup(
            player3_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, player3_panelLayout.createSequentialGroup()
                .addGap(26, 26, 26)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 40, Short.MAX_VALUE)
                .addComponent(iconP3_label, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(30, 30, 30)
                .addComponent(icon_button3, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(human_button3, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        player4_panel.setBackground(new java.awt.Color(255, 153, 204));
        player4_panel.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        player4_panel.setEnabled(false);

        iconP4_label.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                iconP4_labelMouseClicked(evt);
            }
        });

        jPanel4.setBackground(new java.awt.Color(255, 0, 255));
        jPanel4.setPreferredSize(new java.awt.Dimension(122, 39));

        player4name_textfield.setBackground(new java.awt.Color(255, 153, 204));
        player4name_textfield.setFont(new java.awt.Font("Century", 1, 14));
        player4name_textfield.setText("<enter name>");
        player4name_textfield.setBorder(null);
        player4name_textfield.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                player4name_textfieldMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(player4name_textfield, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                .addContainerGap(16, Short.MAX_VALUE)
                .addComponent(player4name_textfield, javax.swing.GroupLayout.PREFERRED_SIZE, 12, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        icon_button4.setText("Next Icon");
        icon_button4.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                icon_button4MouseClicked(evt);
            }
        });

        human_button4.setText("Human");
        human_button4.setPreferredSize(player1name_textfield.getPreferredSize());
        human_button4.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                human_button4MouseClicked(evt);
            }
        });

        javax.swing.GroupLayout player4_panelLayout = new javax.swing.GroupLayout(player4_panel);
        player4_panel.setLayout(player4_panelLayout);
        player4_panelLayout.setHorizontalGroup(
            player4_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(player4_panelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(player4_panelLayout.createSequentialGroup()
                .addGap(42, 42, 42)
                .addComponent(iconP4_label1)
                .addContainerGap(95, Short.MAX_VALUE))
            .addGroup(player4_panelLayout.createSequentialGroup()
                .addGap(18, 18, 18)
                .addComponent(iconP4_label, javax.swing.GroupLayout.DEFAULT_SIZE, 1, Short.MAX_VALUE)
                .addGap(119, 119, 119))
            .addGroup(player4_panelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(human_button4, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(19, Short.MAX_VALUE))
            .addGroup(player4_panelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(icon_button4, javax.swing.GroupLayout.DEFAULT_SIZE, 110, Short.MAX_VALUE)
                .addGap(18, 18, 18))
        );
        player4_panelLayout.setVerticalGroup(
            player4_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(player4_panelLayout.createSequentialGroup()
                .addGap(22, 22, 22)
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(11, 11, 11)
                .addGroup(player4_panelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(iconP4_label, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(player4_panelLayout.createSequentialGroup()
                        .addComponent(iconP4_label1)
                        .addGap(246, 246, 246)))
                .addGap(10, 10, 10)
                .addComponent(icon_button4, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(human_button4, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(12, 12, 12))
        );

        addplayer_label.setIcon(new javax.swing.ImageIcon(getClass().getResource("/model/persiapan/addplayerA.jpg"))); // NOI18N
        addplayer_label.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                addplayer_labelMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                addplayer_labelMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                addplayer_labelMouseExited(evt);
            }
        });

        startgame_label.setIcon(new javax.swing.ImageIcon(getClass().getResource("/model/persiapan/startgameA.jpg"))); // NOI18N
        startgame_label.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                startgame_labelMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                startgame_labelMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                startgame_labelMouseExited(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(16, 16, 16)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(player1_panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGap(0, 0, 0)
                        .addComponent(player2_panel, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, 0)
                        .addComponent(player3_panel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, 0)
                        .addComponent(player4_panel, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(addplayer_label)
                        .addGap(0, 0, 0)
                        .addComponent(startgame_label, 0, 0, Short.MAX_VALUE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(player3_panel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(player1_panel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 416, Short.MAX_VALUE)
                    .addComponent(player4_panel, javax.swing.GroupLayout.DEFAULT_SIZE, 416, Short.MAX_VALUE)
                    .addComponent(player2_panel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(0, 0, 0)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(startgame_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(addplayer_label, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(14, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void addplayer_labelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_addplayer_labelMouseClicked
        if (boleh_klik)
        {
            banyak_pemain++;
            int i = banyak_pemain;
             arrayPanel.get(i).setVisible(true);
             arrayTextField.get(i).requestFocus();
             this.get_currentIcon(i);
             if(banyak_pemain == max_pemain)
                arrayButton.get(banyak_pemain).setVisible(false);
             else
                arrayButton.get(i).setVisible(true);
             arrayButtonH.get(i).setVisible(true);
             boleh_klik = false ;
        }
    }//GEN-LAST:event_addplayer_labelMouseClicked

    private void addplayer_labelMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_addplayer_labelMouseEntered
        this.addplayer_label.setIcon(SearchEngine.createImageIcon("persiapan/addplayerB.jpg"));
    }//GEN-LAST:event_addplayer_labelMouseEntered

    private void addplayer_labelMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_addplayer_labelMouseExited
        this.addplayer_label.setIcon(SearchEngine.createImageIcon("persiapan/addplayerA.jpg"));
    }//GEN-LAST:event_addplayer_labelMouseExited

    private void player1name_textfieldMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_player1name_textfieldMouseClicked
        //banyak_pemain = 1;
        this.player1name_textfield.selectAll();
        this.player1name_textfield.setText("");
        boleh_klik = false;
    }//GEN-LAST:event_player1name_textfieldMouseClicked

    private void player2name_textfieldMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_player2name_textfieldMouseClicked
        //banyak_pemain = 2;
        this.player2name_textfield.selectAll();
        this.player2name_textfield.setText("");
        boleh_klik = false;
    }//GEN-LAST:event_player2name_textfieldMouseClicked

    private void player3name_textfieldMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_player3name_textfieldMouseClicked
        //banyak_pemain = 3;
        this.player3name_textfield.selectAll();
        this.player3name_textfield.setText("");
        boleh_klik = false;
    }//GEN-LAST:event_player3name_textfieldMouseClicked

    private void player4name_textfieldMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_player4name_textfieldMouseClicked
        //banyak_pemain = 4;
        this.player4name_textfield.selectAll();
        this.player4name_textfield.setText("");
        boleh_klik = false;
        p4 = new Player(4,this.player4name_textfield.getText(),this.icon_name,true);
        p4.setNama(this.player4name_textfield.getText());
        p4.setIkon(this.icon_name);
    }//GEN-LAST:event_player4name_textfieldMouseClicked

    @SuppressWarnings("static-access")
    private void iconP1_labelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_iconP1_labelMouseClicked
      if(!player_added[1])
      {
        if((player1name_textfield.getText().equals("<enter name>"))||(player1name_textfield.getText().equals("")))
        {
            System.out.println("please enter your name");
        }
        else
        {
            player1name_textfield.setPreferredSize(jPanel6.getPreferredSize());
            player1name_textfield.setHorizontalAlignment(player1name_textfield.CENTER);
            this.chooseIcon(1);
            banyak_pemain = 1;
            p1 = new Player(1,this.player1name_textfield.getText(),this.icon_name,human1);
            p1.setNama(this.player1name_textfield.getText());
            p1.setIkon(this.icon_name);
            System.out.println(icon_name);
            player_added[1] = true ;
        }
      }
    }//GEN-LAST:event_iconP1_labelMouseClicked

    @SuppressWarnings("static-access")
    private void icon_button1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_icon_button1MouseClicked
        player1name_textfield.setPreferredSize(jPanel6.getPreferredSize());
        player1name_textfield.setHorizontalAlignment(player1name_textfield.CENTER);
        next_counter();
        if(!human1)
            set_computer_name(1);
        this.get_currentIcon(1);
    }//GEN-LAST:event_icon_button1MouseClicked

    @SuppressWarnings("static-access")
    private void icon_button2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_icon_button2MouseClicked
        player2name_textfield.setPreferredSize(jPanel5.getPreferredSize());
        player2name_textfield.setHorizontalAlignment(player2name_textfield.CENTER);
        next_counter();
        if(!human2)
            set_computer_name(2);
        this.get_currentIcon(2);
    }//GEN-LAST:event_icon_button2MouseClicked

    @SuppressWarnings("static-access")
    private void icon_button3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_icon_button3MouseClicked
        player3name_textfield.setPreferredSize(jPanel3.getPreferredSize());
        player3name_textfield.setHorizontalAlignment(player3name_textfield.CENTER);
        next_counter();
        if(!human3)
            set_computer_name(3);
        this.get_currentIcon(3);
    }//GEN-LAST:event_icon_button3MouseClicked

    @SuppressWarnings("static-access")
    private void IconP2_labelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_IconP2_labelMouseClicked
      if(!player_added[2])
      {
        if((player2name_textfield.getText().equals("<enter name>"))||(player2name_textfield.getText().equals("")))
        {
            System.out.println("please enter your name");
        }
        else
        {
            player2name_textfield.setPreferredSize(jPanel5.getPreferredSize());
            player2name_textfield.setHorizontalAlignment(player2name_textfield.CENTER);
            this.chooseIcon(2);
            banyak_pemain = 2;
            p2 = new Player(2,this.player2name_textfield.getText(),this.icon_name,human2);
            p2.setNama(this.player2name_textfield.getText());
            p2.setIkon(this.icon_name);
            System.out.println(this.icon_name);
            player_added[2] = true ;
        }
      }
    }//GEN-LAST:event_IconP2_labelMouseClicked

    @SuppressWarnings("static-access")
    private void iconP3_labelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_iconP3_labelMouseClicked
      if(!player_added[3])
      {
        if((player3name_textfield.getText().equals("<enter name>"))||(player3name_textfield.getText().equals("")))
        {
            System.out.println("please enter your name");
        }
        else
        {
            player3name_textfield.setPreferredSize(jPanel3.getPreferredSize());
            player3name_textfield.setHorizontalAlignment(player3name_textfield.CENTER);
            this.chooseIcon(3);
            banyak_pemain = 3;
            p3 = new Player(3,this.player3name_textfield.getText(),this.icon_name,human3);
            p3.setNama(this.player3name_textfield.getText());
            p3.setIkon(this.icon_name);
            System.out.println(this.icon_name);
            player_added[3] = true ;
        }
      }
    }//GEN-LAST:event_iconP3_labelMouseClicked

    private void iconP4_labelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_iconP4_labelMouseClicked
      if(!player_added[4])
      {
        if((player4name_textfield.getText().equals("<enter name>"))||(player4name_textfield.getText().equals("")))
        {
            System.out.println("please enter your name");
        }
        else
        {
            player4name_textfield.setPreferredSize(jPanel4.getPreferredSize());
            player4name_textfield.setHorizontalAlignment(player4name_textfield.CENTER);
            this.chooseIcon(4);
            banyak_pemain = 4;
            p4 = new Player(4,this.player4name_textfield.getText(),this.icon_name,human4);
            p4.setNama(this.player4name_textfield.getText());
            p4.setIkon(this.icon_name);
            boleh_klik = false;
            player_added[4] = true ;
            //this.player4name_textfield.setEnabled(false);
        }
      }
    }//GEN-LAST:event_iconP4_labelMouseClicked

private void startgame_labelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_startgame_labelMouseClicked
        this.setVisible(false);
        new Profiles(true).setVisible(true);
}//GEN-LAST:event_startgame_labelMouseClicked

private void startgame_labelMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_startgame_labelMouseEntered
        this.startgame_label.setIcon(SearchEngine.createImageIcon("persiapan/startgameB.jpg"));
}//GEN-LAST:event_startgame_labelMouseEntered

private void startgame_labelMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_startgame_labelMouseExited
        this.startgame_label.setIcon(SearchEngine.createImageIcon("persiapan/startgameA.jpg"));
}//GEN-LAST:event_startgame_labelMouseExited

private void formOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formOpened
      counter = 1;
}//GEN-LAST:event_formOpened

private void human_button1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_human_button1MouseClicked
    // TODO add your handling code here:
    if(human1 == true)
    {
        human1 = false;
        human_button1.setText("Computer");
        set_computer_name(1);
        System.out.println("to computer");
        player1name_textfield.setEditable(false);
    }
    else
    {
        human1 = true ;
        human_button1.setText("Human");
        player1name_textfield.setText("<enter name>");
        player1name_textfield.setEditable(true);
        System.out.println("to human");
    }
}//GEN-LAST:event_human_button1MouseClicked

private void human_button2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_human_button2MouseClicked
    // TODO add your handling code here:
    if(human2 == true)
    {
        human2 = false;
        human_button2.setText("Computer");
        set_computer_name(2);
        System.out.println("to computer");
        player1name_textfield.setEditable(false);
    }
    else
    {
        human2 = true ;
        human_button2.setText("Human");
        player2name_textfield.setText("<enter name>");
        System.out.println("to human");
        player2name_textfield.setEditable(true);
    }
}//GEN-LAST:event_human_button2MouseClicked

private void human_button3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_human_button3MouseClicked
    // TODO add your handling code here:
    if(human3 == true)
    {
        human3 = false;
        human_button3.setText("Computer");
        set_computer_name(3);
        System.out.println("to computer");
        player3name_textfield.setEditable(false);
    }
    else
    {
        human3 = true ;
        human_button3.setText("Human");
        player3name_textfield.setText("<enter name>");
        player3name_textfield.setEditable(true);
        System.out.println("to human");
    }
}//GEN-LAST:event_human_button3MouseClicked

private void human_button4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_human_button4MouseClicked
    // TODO add your handling code here:
    if(human4 == true)
    {
        human4 = false;
        human_button4.setText("Computer");
        set_computer_name(4);
        System.out.println("to computer");
        player4name_textfield.setEditable(false);
    }
    else
    {
        human4 = true ;
        human_button4.setText("Human");
        player4name_textfield.setText("<enter name>");
        player4name_textfield.setEditable(true);
        System.out.println("to human");
    }
}//GEN-LAST:event_human_button4MouseClicked

private void icon_button4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_icon_button4MouseClicked
    // TODO add your handling code here:
        player4name_textfield.setPreferredSize(jPanel4.getPreferredSize());
        player4name_textfield.setHorizontalAlignment(player4name_textfield.CENTER);
        next_counter();
        if(!human4)
            set_computer_name(4);
        this.get_currentIcon(4);
}//GEN-LAST:event_icon_button4MouseClicked

    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new CreatePlayer(null).setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel IconP2_label;
    private javax.swing.JLabel addplayer_label;
    private javax.swing.JButton human_button1;
    private javax.swing.JButton human_button2;
    private javax.swing.JButton human_button3;
    private javax.swing.JButton human_button4;
    private javax.swing.JLabel iconP1_label;
    private javax.swing.JLabel iconP1_label1;
    private javax.swing.JLabel iconP3_label;
    private javax.swing.JLabel iconP4_label;
    private javax.swing.JLabel iconP4_label1;
    private javax.swing.JButton icon_button1;
    private javax.swing.JButton icon_button2;
    private javax.swing.JButton icon_button3;
    private javax.swing.JButton icon_button4;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel player1_panel;
    private javax.swing.JTextField player1name_textfield;
    private javax.swing.JPanel player2_panel;
    private javax.swing.JTextField player2name_textfield;
    private javax.swing.JPanel player3_panel;
    private javax.swing.JTextField player3name_textfield;
    private javax.swing.JPanel player4_panel;
    private javax.swing.JTextField player4name_textfield;
    private javax.swing.JLabel startgame_label;
    // End of variables declaration//GEN-END:variables

    public void actionPerformed(ActionEvent e) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

}
